package LanQiao;

import java.util.Scanner;

public class Demo5 {
    public static void main(String[] args) {
        int len1 = 0, len2 = 0;

        Scanner scanner = new Scanner(System.in);

        len1 = scanner.nextInt();

        int[] e = new int[len1];


        for (int i = 0; i < len1; i++) {
            e[i] = scanner.nextInt();
        }

        len2 = scanner.nextInt();

        int[] v = new int[len2];

        for (int i = 0; i < len2; i++) {
            v[i] = scanner.nextInt();
        }

        int count = 0;//礼物下标

        int sum = 0;//有多少个村名可以拿到礼物

        for (int i = 0; i < len1 && count < len2; i++) {
            while (count < len2 && e[i] > v[count]) {
                count++;
            }
            if (count >= len2) {
                break;
            }
            sum++;
            count++;
        }

        System.out.println(sum);
    }
}
